<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * @property string $publish_at
 */
class OAGongGaos extends Model
{
    protected $table = 'gonggaos';
    public $timestamps  = false;
    protected $fillable = [
        'title',
        'content',
        'uid',
        'dept_id',
        'publish_at'
    ];

    protected $attributes = [
        'publish_at'=>'date'
    ];

    public function user()
    {
        return $this->belongsTo(OAStaff::class,'uid');
    }

    public function setPublishAtAttribute()
    {
        $this->attributes['publish_at'] = now()->toDateTimeString();
    }
}
